package com.geek.javase.Game;

import java.util.concurrent.TimeUnit;

/**
 * @author chenshupeng
 * @date 2025/9/3
 * @desc TODO
 **/

public class Main {
    public static void main(String[] args) {
        Hero hero = new Hero("李瑞","人族",250,10,5,6);
        Monster monster = new Monster("狗","狗类",300,30,15,2);

        Equip equip1 = new Equip("AWP" , 6 , "金色" , "剑类" , 13 , 0);
        Equip equip2 = new Equip("沙鹰" , 7 , "银色" , "刀类" , 12, 20);
        Equip equip3 = new Equip("手雷" , 6 , "白色" , "盾类" , 100 , 0);
        Equip equip4 = new Equip("枪" , 3 , "橙色" , "小刀" , 22 , 0);
        hero.addEquip(equip1);
        hero.addEquip(equip2);
        hero.addEquip(equip3);
        //hero.addEquip(equip4);

        /*hero.show();
        System.out.println("----------------");
        monster.show();*/

        //回合制攻击
        int count = 0;
        boolean flag=true;
        while (flag){
            System.out.println("----------- 第"+(++count)+"轮攻击------------");

            hero.attack(monster);
            if(monster.getBlood()<=0) {
                System.out.println(monster.getName() + "死亡");
                flag=false;
            }
            else
                System.out.println(monster.getName()+"剩余血量"+monster.getBlood());
            //沉睡
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            monster.attack(hero);
            if(hero.getBlood()>0)
                System.out.println(hero.getName()+"剩余血量"+hero.getBlood());
            else
            {
                System.out.println(hero.getName()+"死亡");
                flag=false;
            }
            //沉睡
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
